import { ref } from 'vue'

// 先搭架子
export function useWindowScroll () {
  const y = ref(0)
  window.addEventListener('scroll', () => {
    // 获取到当滚动的距离 赋值给y
    const scrollTop = document.documentElement.scrollTop
    y.value = scrollTop
  })

  return { y }
}
